from urllib import request, parse  

# 定义 URL 和 headers
url = 'http://httpbin.org/post'  
headers = {
    'User-Agent': 'Mozilla/4.0 (compatible; MSIE 5.5; Windows NT)',
    'Host': 'httpbin.org'  
}  

# 定义表单数据和编码方式
dict = {'name': 'Germey'}  
data = bytes(parse.urlencode(dict), encoding='utf8')  

# 创建 Request 对象
req = request.Request(url=url, data=data, headers=headers, method='POST')  

# 发起请求并接收响应
response = request.urlopen(req)  

# 输出响应内容
print(response.read().decode('utf-8'))